<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
	<meta name="format-detection" content="telephone=no">
	<title>订单详情</title>
	<base id="headbase" href="__TMPL__/seatsel/" />
	{include file="./tplnew/public/css_weui.html" /}
	<link rel="stylesheet" href="css/style.css?{$suffix}" />
</head>
<body class="body-fixed-bottom">

<!--主体-->
<header class="wy-header">
	<a href="javascript:history.back(-1);" class="wy-header-icon-back"><span></span></a>
	<div class="wy-header-title">订单详情</div>
</header>

<form method="post" action="{:url('seatsel/orderSubmit/doSubmit')}" class="J_ajaxForm">
	<input type="hidden" name="initPid" value="{$initPid}" />
	<input type="hidden" name="initSpecId" value="{$initSpecId}" />
	<input type="hidden" name="isVip" value="{$isVip}" />
	<input type="hidden" id="J_addressId" name="addressId" value="{$addressInfo['id']}">
	<input type="hidden" name="userVoucherId" value="{$userVoucherId}">
	<input type="hidden" name="formhash" value="{$formhash}" />

	<input type="hidden" id="J_cartProductPrice" name="cartProductPrice" value="{$cartProductPrice}" />
	<input type="hidden" id="J_cartDeliveryPrice" name="cartDeliveryPrice" value="{$cartDeliveryPrice}" />
	<input type="hidden" id="J_cartVoucherPrice" name="cartVoucherPrice" value="{$cartVoucherPrice}" />
	
<div class="weui-content">
	<div class="wy-media-box weui-media-box_text">
		<div class="weui-media-box__bd">
			<div class="weui-media-box_appmsg ord-pro-list">
				<div class="weui-media-box__hd">
					<img class="weui-media-box__thumb" src="{$productInfo['picurl']}" width="80px" />
				</div>
				<div class="weui-media-box__bd">
					<h1 class="wefix-media-box__we_title ord-pro-link"><a href="javascript:;">{$productInfo['name']}</a></h1>
					<ul class="show-cloord-time">
						<li><i><img src="images/details-time.png"></i><span class="address-time">{$specInfo['name']}</span></li>
						<li><i><img src="images/details-location.png"></i><span class="address-location">{$productInfo['place']}</span></li>
					</ul>
					{if condition="$productInfo['is_spec_open'] eq 1"}
						<p class="weui-media-box__desc">规格：<span>{$vo2['spec_1']}</span>，<span>{$vo2['spec_2']}</span></p>
					{/if}
					<div class="clear mg-t-10 hide">
						<div class="wy-pro-pri fl">¥<em class="num font-15">{$vo2['one_price']}</em></div>
						<div class="pro-amount fr"><span class="font-13">数量×<em class="name">{$vo2['buy_num']}</em></span></div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="weui-panel">
		<div class="weui-panel__hd">商品</div>
		<div class="weui-panel__bd">
			<div class="weui-media-box weui-media-box_appmsg">
				<div class="details-seat">
					{volist name="seatList" id="vo"}
					<?php
						$seatNum++;
						$productFee = $vo['real_price'];
					?>
						<input type="hidden" name="ids[]" value="{$vo['id']}" />
						<span>{$vo['region_name']}{$vo['pai']}排{$vo['zuo']}座【{$vo['real_price']}元】</span>
					{/volist}
				</div>
			</div>
		</div>
		<div class="weui-panel__ft">
			<div class="weui-cell weui-cell_access weui-cell_link">
				<div class="weui-cell__bd">
					<dl class="flow-dis-hj-dl">
						<dd><span>共 <strong class="ticket-total">{$seatNum}</strong> 张</span><span>合计：<strong class="ticket-payment">{$cartTotalPrice}</strong>元</span></dd>
					</dl>
				</div>
			</div>
		</div>
	</div>
	<!-- 配送方式 -->
	<?php
		$seatNum = 0; //数量
		$selfpickupChecked = $expressChecked = $fictitiousChecked = '';
		$selfpickupStyle = $expressStyle = $fictitiousChecked = 'display:none;';
		if ($goodMode == 1) {
			$deliveryMode = 1;
			$fictitiousChecked = 'checked';
		} else if ($goodMode == 2) {
			$deliveryMode = 2;
			if ($deliveryMode == 1) {
				$selfpickupChecked = 'checked';
				$selfpickupStyle = '';
			} else if ($deliveryMode == 2) {
				$expressChecked = 'checked';
				$expressStyle = 'checked';
			}
		}
	?>
	<div class="weui-panel">
		<div class="weui-panel__bd">
			<div class="weui-cell weui-cell_access f14 J_delivery_mode">
				<div class="weui-cell__hd"><label class="weui-label">配送方式</label></div>
				<div class="weui-cell__bd weui-cell_primary">
					{if condition="$goodMode == 1"}
						<label><input type="radio" name="delivery_mode" value="4" {$fictitiousChecked}>电子卡券（无需配送）</label>
					{/if}
					{if condition="$goodMode == 2 || $goodMode == 3"}
						{if condition="$goodMode == 3"}
							<label><input type="radio" name="delivery_mode" value="1" {$selfpickupChecked}>自提</label>
						{/if}
						<label><input type="radio" name="delivery_mode" value="2" {$expressChecked}>快递</label>
					{/if}
				</div>
			</div>
			<div class="weui-cell weui-cell_access f14 selfpickup-wrap J_selfpickup_wrap" style="display:none;">
				<div class="weui-cell__hd"><label class="weui-label">自提点选择</label></div>
				<div class="weui-cell__bd weui-cell_primary c-red2">
					{volist name="selfpickupList" id="vo"}
						<label><input type="radio" name="selfpickupId" value="{$vo['id']}">{$vo['name']}({$vo['address']} 电话：{$vo['tel']})</label>
					{/volist}
				</div>
			</div>
			<div class="weui-panel weui-panel_access mt0 J_address_wrap" style="display:none;">
				<div class="weui-panel__bd">
					{if condition="$addressInfo"}
						<div id="J_defaultAddress" class="weui-media-box weui-media-box_appmsg J_address">
							<div class="weui-media-box__hd proinfo-txt-l" style="width:20px;">
								<span class="promotion-label-tit"><img src="images/icon_nav_city.png" /></span>
							</div>
							<div class="weui-media-box__bd">
								<h4 class="address-name">
									<span>{$addressInfo['realname']}</span>
									<span>{$addressInfo['mobile']}</span>
								</h4>
								<div class="address-txt">{$addressInfo['province']}{$addressInfo['city']}{$addressInfo['county']}{$addressInfo['address_detail']}</div>
							</div>
						</div>
					{else}
						<div id="J_createAddress" class="weui-media-box weui-media-box_appmsg J_address">
							<div class="weui-media-box__hd proinfo-txt-l" style="width:20px;">
								<span class="promotion-label-tit"><img src="images/icon_nav_city.png" /></span>
							</div>
							<div class="weui-media-box__bd">
								<p class="weui-media-box__desc">新建收货地址</p>
							</div>
						</div>
					{/if}

					<div id="J_chooseAddress" class="weui-media-box weui-media-box_appmsg J_address" style="display:none;">
						<div class="weui-media-box__hd proinfo-txt-l" style="width:20px;">
							<span class="promotion-label-tit"><img src="images/icon_nav_city.png" /></span>
						</div>
						<div class="weui-media-box__bd">
							<h4 class="address-name">
								<span class="realname">{$addressInfo['realname']}</span>
								<span class="mobile">{$addressInfo['mobile']}</span>
							</h4>
							<div class="address-txt address">{$addressInfo['province']}{$addressInfo['city']}{$addressInfo['county']}{$addressInfo['address_detail']}</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

	<!-- 留言信息 -->
	<div class="weui-panel">
		<div class="weui-panel__bd">
			<div class="weui-media-box weui-media-box_small-appmsg">
				<div class="weui-cells">
					{volist name="leavemess_fields" id="vo"}
					<?php
						//获取默认值
						if ($vo['flag'] == 'realname') {
							$defaultValue = $moondb['realname'];
						} else if ($vo['flag'] == 'mobile') {
							$defaultValue = $moondb['mobile'];
						} else {
							$defaultValue = '';
						}
					?>
					<div class="weui-cell weui-cell_access f14 J_user_wrap">
						<div class="weui-cell__hd"><label class="weui-label">{$vo['name']}</label></div>
						<div class="weui-cell__bd weui-cell_primary">
							<input type="text" name="leavemessInput[{$vo['flag']}]" value="{$defaultValue}" placeholder="{$vo['desc']}" class="weui-input" />
						</div>
					</div>
					{/volist}
				</div>
			</div>
		</div>
	</div>
	
	<!-- 价格展示 -->
	<div class="weui-panel">
		<div class="weui-panel__bd">
			<div class="weui-media-box weui-media-box_small-appmsg">
				<div class="weui-cells">
					<div class="weui-cell weui-cell_access" href="javascript:;">
						<div class="weui-cell__bd weui-cell_primary">
							<p class="font-14"><span class="mg-r-10">商品金额</span><span class="fr txt-color-red">￥<em class="num J_productPrice">{$cartProductPrice}</em></span></p>
						</div>
					</div>
					<div class="weui-cell weui-cell_access" href="javascript:;">
						<div class="weui-cell__bd weui-cell_primary">
							<p class="font-14"><span class="mg-r-10">运费金额</span><span class="fr txt-color-red">￥<em class="num J_deliveryPrice">{$cartDeliveryPrice}</em></span></p>
						</div>
					</div>
					<!-- 抵扣券 -->
					<a class="weui-cell weui-cell_access" href="{:url('seatsel/orderVoucher/getList', ['initMode'=>$initMode, 'initPid'=>$initPid, 'initSpecId'=>$initSpecId, 'idStr'=>$idStr])}">
						<div class="weui-cell__bd weui-cell_primary">
							{if condition="$userVoucherInfo['id']"}
							<p class="font-14"><span class="mg-r-10">抵扣券</span><span class="fr"><em class="num">{$userVoucherInfo['voucher_name']}(金额：{$userVoucherInfo['real_amount']})</em></span></p>
							{else /}
							<p class="font-14"><span class="mg-r-10">抵扣券</span><span class="fr">暂无抵扣券</span></p>
							{/if}
						</div>
						<div class="weui-cell__ft"></div>
					</a>
					<div class="weui-cell weui-cell_access" href="javascript:;">
						<div class="weui-cell__bd weui-cell_primary">
							<p class="font-14"><span class="mg-r-10">应付金额</span><span class="fr txt-color-red">￥<em class="num J_totalPrice">{$cartTotalPrice}</em></span></p>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="wy-media-box weui-media-box_text" style="display:none;">
		<div class="mg10-0 t-c">总金额：<span class="wy-pro-pri mg-tb-5">¥<em class="num font-20">296.00</em></span></div>
		<div class="mg10-0"><a href="shopcart.html" class="weui-btn weui-btn_primary">微信付款</a></div>
	</div>
</div>

<!--底部导航-->
<div class="weui-tabbar wy-foot-menu">
	<div class="weui-tabbar__item npd">
		<p class="cart-total-txt" style="text-align:right;padding-right:10px;">合计：<i>￥</i><em class="num font-16 J_totalPrice">{$cartTotalPrice}</em></p>
	</div>
	<button type="submit" class="red-color npd w-90 t-c J_ajaxSubmit">
		<p class="promotion-foot-menu-label">提交订单</p>
	</button>
</div>

</form>

<?php
$layerStyle = 2;
?>
{include file="./tplnew/public/script_weui.html" /}
<script src="js/public.js?{$suffix}"></script>

<script type="text/javascript">
var url_getAddress = "{:url('seatsel/address/getAddress')}"; //获取地址列表

//收货地址
$('.J_address').on('click', function(e){
	e.preventDefault();
	$.post(url_getAddress, '', function(data){
		layer.open({
			type: 1,
			closeBtn: true,
			shift: 2,
			offset: 'b',
			area: ['100%', 'auto'],
			title: '选择收货地址',
			content: data
		});
	}, "text");
});
</script>

<script type="text/javascript">
//快递自提切换
$('.J_delivery_mode').on("change", "input:radio[name='delivery_mode']", function(){
	var cartProductPrice = $('#J_cartProductPrice').val();
	var cartDeliveryPrice = $('#J_cartDeliveryPrice').val();
	var cartVoucherPrice = $('#J_cartVoucherPrice').val();
	var productPrice = parseFloat(cartProductPrice);
	var deliveryPrice = parseFloat(cartDeliveryPrice);
	var voucherPrice = parseFloat(cartVoucherPrice);
	console.log('商品金额:', productPrice);
	console.log('运费金额:', deliveryPrice);
	console.log('抵扣金额:', voucherPrice);
	var tval = $(this).val();
	console.log('tval:', tval);
	if(tval == 2){
		$('.J_deliveryPrice').html(0);
		$('.J_totalPrice').html(number_format(productPrice, 2));

		$('.J_selfpickup_wrap').show();
		$('.J_user_wrap').show();
		$('.J_address_wrap').hide();
	}else if(tval == 1){
		$('.J_deliveryPrice').html(number_format(deliveryPrice));
		$('.J_totalPrice').html(number_format(productPrice+deliveryPrice-voucherPrice, 2));

		$('.J_selfpickup_wrap').hide();
		$('.J_user_wrap').hide();
		$('.J_address_wrap').show();
	}else if(tval == 4){
		$('.J_deliveryPrice').html(number_format(deliveryPrice));
		$('.J_totalPrice').html(number_format(productPrice+deliveryPrice-voucherPrice, 2));

		$('.J_selfpickup_wrap').hide();
		$('.J_user_wrap').show();
		$('.J_address_wrap').hide();
	}
});
</script>
</body>
</html>